package day0111;

public class Student extends Person{
	private String className;
	
	public void study() {
		System.out.println("id是"+ id +"的"+ name +"正在"+ className +"学习");
	}

//	public Student(int id, String name, int age, String className) {
//		//super(id, name, age);
//		this.className = className;
//		this.id = id;
//		this.age = age;
//		this.name = name;
//	}         
	
	//在构造方法new子类对象的时候，首先要把父类对象new出来
	public Student() {
		//代表调用父类的无参构造方法，相当于new Person()
		super();
	}

	public Student(int id, String name, int age, String className) {
		//调用父类的有参构造方法，相当于new Person（id,name,age）
		super(id, name, age);
		this.className = className;
	}

	public String getClassName() {
		return className;
	}

	public void setClassName(String className) {
		this.className = className;
	}

	@Override
	public String toString() {
		return "Student [className=" + className + ", id=" + id + ", name=" + name + ", age=" + age + "]";
	}

	
	
	
}
